package fr.cavalier.sort;

import java.util.Arrays;

import org.apache.commons.lang3.ArrayUtils;

public class EfficientSort {

	public static int[] mergeSort(int[] array){
		if(array.length == 1){
			return array;
		}else{
			int[]array1= mergeSort(Arrays.copyOfRange(array, 0, array.length/2));
			int[]array2= mergeSort(Arrays.copyOfRange(array, array.length/2, array.length));
			if(array1[0]>array2[0]){
				return ArrayUtils.addAll(array1, array2);
			}else{
				return ArrayUtils.addAll(array2, array1);
			}
		}
	}
	

}
